package cn.walls1717.ggkt.activity.api;

import cn.walls1717.ggkt.activity.service.CouponInfoService;
import cn.walls1717.ggkt.model.activity.CouponInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 前台优惠券相关接口
 *
 * @author walls1717
 * @since 2022/7/22
 */
@Api(tags = "前台优惠券相关接口")
@RestController
@RequestMapping("/api/activity/couponInfo")
public class CouponInfoApiController {

	@Autowired
	private CouponInfoService couponInfoService;

	@ApiOperation("获取优惠券")
	@GetMapping("inner/getById/{couponId}")
	public CouponInfo getCouponById(@PathVariable("couponId") Long couponId) {
		return couponInfoService.getById(couponId);
	}

    @ApiOperation("更新优惠券使用状态")
	@GetMapping("inner/updateCouponInfoUseStatus/{couponUseId}/{orderId}")
	public Boolean innerUpdateCouponInfoUseStatus(@PathVariable("couponUseId") Long couponUseId, @PathVariable("orderId") Long orderId) {
		couponInfoService.updateCouponInfoUseStatus(couponUseId, orderId);
		return true;
	}
}